<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>搜索</title>
		<link rel="stylesheet" type="text/css" href="__API__/lib/css/swiper.min.css">
		<link rel="stylesheet" type="text/css" href="__API__/lib/css/mui.css?v=1">
		<link rel="stylesheet" type="text/css" href="__API__/lib/css/mobileSelect.css" />
		<link rel="stylesheet" href="__API__/lib/css/style.css">
		<script type="text/javascript" src="__API__/lib/js/jquery-1.11.0.min.js"></script>
		<script type="text/javascript" src="__API__/lib/js/mui.js"></script>
		<script src="__API__/lib/js/mobileSelect.js" type="text/javascript" charset="utf-8"></script>
		<script src="__API__/lib/js/city.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="__API__/lib/js/swiper.min.js"></script>
		<script type="text/javascript" src="__API__/lib/js/vue.min.js"></script>
		<script type="text/javascript" src="__API__/lib/js/common.js"></script>
		<script type="text/javascript" src="__API__/lib/js/index.js"></script>
	<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script></head>

	<body>
		<div class="search_page" id="app">
<!--			<div class="searchfiexd">-->
<!--				<div class="searchsort tab">-->
<!--					<div class="li" :class="{'active':tabIndex == 0}" @click="onTab(0)">默认</div>-->
<!--					<div class="li" :class="{'active':tabIndex == 1}" @click="onTab(1)">价格<img v-if="tabIndex != 1"-->
<!--							src="__API__/lib/images/sx.png" alt=""><img v-else-->
<!--							:src="isxl ? 'lib/images/sx3.png':'lib/images/sx2.png'" alt=""></div>-->
<!--					<div class="li" :class="{'active':tabIndex == 2}" @click="onTab(2)">类别<img v-if="tabIndex != 2"-->
<!--							src="__API__/lib/images/sx.png" alt=""><img v-else-->
<!--							:src="issj ? 'lib/images/sx3.png':'lib/images/sx2.png'" alt=""></div>-->
<!--				</div>-->
<!--			</div>-->
			<!--header end-->
			<div class="search_cont">
				<ul class="search_list" v-if="goodsList.length > 0">
					<li v-for="(item,i) in goodsList" :key="i" @click="goDetail('goods_detail.html?id='+item.id)">
						<div class="img"><img :src="item.single_pic" alt=""></div>
						<div class="info">
							<div class="left">
								<h3>{{item.title}}</h3>
								<span>{{item.type_title}}</span>
								<p class="price">￥{{item.price}}</p>
							</div>
							<div class="collect"><img src="__API__/lib/images/collect2.png" alt=""></div>
						</div>
					</li>
				</ul>
				<div class="null_box" v-else>
					<div class="img"><img src="__API__/lib/images/search_null.png" alt=""></div>
					<p>暂无搜索结果~</p>
				</div>
			</div>
		</div>
		<style>
			.search_cont{ padding: 0}
		</style>
		<script>
			var app = null;
			app = new Vue({
				el: '#app',
				data: {
					tabIndex: 0,
					searchValue: '',
					isxl: false,
					issj: false,
					goodsList: [

					]
				},
				created: function() {
					var that = this;
					var searchValue = common.getQueryStringRegExp("title");
					common.ajax("{:url('Goods/all')}",{title:searchValue} , function(res) {
						that.goodsList = res.data;
						// that.getData(searchValue);
					});
				},
				methods: {
					getData(value) {
						let that = this;
						let data = {
							searchValue: value
						}
						common.ajax('', data, function(res) {

						})
					},
					onTab(i) {
						this.tabIndex = i;
						if (i == 0) {
							this.isxl = false;
							this.issj = false;
						}
						if (i == 1) {
							this.isxl = !this.isxl;
							this.issj = false;
						}
						if (i == 2) {
							this.isxl = false;
							this.issj = !this.issj;
						}
					},
					goDetail(url) {
						common.openUrl(url)
					},
					onSearch() {
						var that = this;
						if (that.searchValue == '') {
							return common.alet('请输入搜索内容!')
						}
						common.openUrl('search_result.html?value=' + that.searchValue)
					}
				}
			});
		</script>
	</body>

</html>
